# 使用while循环实现计算n的阶乘
# 5！ = 1 * 2 * 3 * 4 * 5


'''
1 * 2 * 3 * 4 * 5

i = 1

i = i * 2
i = i * 3
i = i * 4
i = i * 5
'''

'''while循环'''

# n = int(input("请输入一个整数:"))
# i = 1
# j = 2
# while j <= n:
#     i = i * j
#     j += 1
# else:
#     print("{}!计算完成 ，循环正常结束".format(n))
# print(i)

'''for循环'''
'''
range(0,100,1)   :参数一[可选参数]：起始数字，参数二：停止数字；参数三[可选参数]：步长
'''
n = int(input("请输入一个整数:"))
i = 1
for j in range(1,n+1):
    i = i * j
    print(j)
print(i)
'''
i = 1
j = 1
i = i * j   ---> i = 1 * 1
___________________
i = 1
j = 2
i = i * j   ---> i = 1 * 2
___________________
i = 2
j = 3
i = i * j   ---> i = 2 * 3
___________________
i = 6
j = 4
i = i * j   ---> i = 6 * 4
___________________
i = 24
j = 5
i = i * j   ---> i = 24 * 5

'''


